package orz.mikeneck.server.locrec.controller;

import java.util.Date;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import orz.mikeneck.server.locrec.ApiServlet;
import orz.mikeneck.server.locrec.model.LocRecGpsModel;
import orz.mikeneck.server.locrec.model.LocRecGpsModelImpl;

public class ApiPostDeleteRecord implements ApiHandler {

	private HttpServletResponse response;

	private HttpServletRequest request;

	private Date called;

	private static final Logger log = Logger.getLogger(ApiServlet.class.getName());

	@Override
	public ApiHandler requestIs(HttpServletRequest req) {
		this.request = req;
		return this;
	}

	@Override
	public ApiHandler responseIs(HttpServletResponse resp) {
		this.response = resp;
		return this;
	}

	@Override
	public boolean execute() {
		String loginId = request.getParameter(LOGIN_ID);
		LocRecGpsModel model = new LocRecGpsModelImpl()
				.loginIdIs(loginId);
		model.deletePersistence();
		return true;
	}

	@Override
	public ApiHandler calledAt(Date calledAt) {
		this.called = calledAt;
		return this;
	}
}
